package com.jh.paymentchannel.service;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.jnewsdk.util.StringUtils;
@Controller
@EnableAutoConfiguration
public class SFKJInfoPage {
	 
	private static final Logger LOG = LoggerFactory.getLogger(SFKJInfoPage.class);
	
	
	@RequestMapping(method=RequestMethod.GET,value="/v1.0/paymentchannel/topup/sfkj")
	public  String returnpay(HttpServletRequest request, HttpServletResponse response, Model model)throws IOException {
		
		Map map = new HashMap();
		// 设置编码
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		String mchno = request.getParameter("mch_id");
		String ordercode = request.getParameter("out_trade_no");
		String amount = request.getParameter("total_fee");
		String desc = request.getParameter("body");
		String bankname = request.getParameter("acc_bank_name");
		String username = request.getParameter("acc_name");
		String cardno = request.getParameter("acc_no");
		String mobile = request.getParameter("mobile");
		String idcard = request.getParameter("id_no");
		String banknum = request.getParameter("bank_code");
		String expdate = request.getParameter("expire_date");
		String cvv = request.getParameter("cvv");
		String num = request.getParameter("nonce_str");
		String sign = request.getParameter("sign");
		String phoneX = request.getParameter("phoneX");
		String cardType = request.getParameter("acct_type");
		String secretKey = request.getParameter("secretKey");
		LOG.info("接口/v1.0/paymentchannel/topup/sfkj——@mchno="+mchno+"@ordercode="+ordercode+"@amount="+amount+"@desc="+desc
				+"@bankname="+bankname+"@username="+username+"@cardno="+cardno+"@mobile="+mobile
				+"@idcard="+idcard+"@banknum="+banknum+"@expdate="+expdate+"@cvv="+cvv+"@num="+num);
			model.addAttribute("mchno", mchno);
			model.addAttribute("ordercode",ordercode);
			model.addAttribute("amount", amount);
			model.addAttribute("desc", desc);
			model.addAttribute("bankname", bankname);
			model.addAttribute("username", username);
			model.addAttribute("cardno", cardno);
			model.addAttribute("mobile", mobile);
			model.addAttribute("idcard", idcard);
			model.addAttribute("banknum", banknum);
			model.addAttribute("expdate", expdate);
			model.addAttribute("cvv", cvv);
			model.addAttribute("num", num);
			model.addAttribute("sign", sign);
			model.addAttribute("phoneX", phoneX);
			model.addAttribute("cardType", cardType);
			model.addAttribute("secretKey", secretKey);
			return "zhifuSFKJ";
		
	}
	
}
